package weba_Examen.webaExamen;

import java.util.List;

import modelo.HibernateUtil;

import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        Session s=HibernateUtil.getSessionFactory().getCurrentSession();
        List l=null;		
        Transaction tx =s.getTransaction();
        try {
			tx.begin();
			Query q= s.createQuery("from Personas");
			l=q.list();
			tx.commit();
		} catch (HibernateException he) {
			// TODO: handle exception
			he.printStackTrace();
		}finally{
			if (tx!=null && tx.isActive()){
				tx.rollback();
			}
		}
        
        System.out.println(l);
        
        		
    }
}
